package cn.gxljc.technology.store_management.mapper;

import cn.gxljc.technology.store_management.entity.WarehouseManagement;
import lombok.Data;
import org.apache.ibatis.annotations.*;

import java.util.List;

/*
 **@author LuoShengYing
 **@date 2021/6/19
 * WarehouseManagementMapper用于管理WarehouseManagement(仓库管理)表
 */
@Mapper
public interface WarehouseManagementMapper {

    // 通过warehouseID，查询仓库管理信息
    @Select("select * from `warehousemanagement` where `warehouseID` = #{warehouseID}")
    WarehouseManagement selectWMByWarehouseID(int warehouseID);

    // 通过accountID，查询仓库管理信息
    @Select("select * from `warehousemanagement` where `accountID` = #{accountID}")
    WarehouseManagement selectWMByAccountID(long accountID);

    // 新增仓库管理信息，并返回boolean类型数据判断成功与否
    @Insert("insert `warehousemanagement` set `warehouseID` = #{warehouseID}, `accountID` = #{accountID}")
    boolean insertWM(WarehouseManagement WM);

    // 更新仓库管理人，并返回boolean类型数据判断成功与否
    @Update("update `warehousemanagement` set `accountID` = #{accountID} where `warehouseID` = #{warehouseID}")
    boolean updateWM(int warehouseID, long accountID);

    // 通过warehouseID，删除仓库管理信息，并返回boolean类型数据判断成功与否
    @Delete("delete from `warehousemanagement` where `warehouseID` = #{warehouseID}")
    boolean deleteWMByWarehouseID(int warehouseID);

    // 通过accountID，删除仓库管理信息，并返回boolean类型数据判断成功与否
    @Delete("delete from `warehousemanagement` where `accountID` = #{accountID}")
    boolean deleteWMByAccountID(long accountID);
}
